import type { Router } from "express"
import type { Ioracle, IcallbackFn } from "../../types"

export default (router: Router, oracle: Ioracle, callbackFn: IcallbackFn) => {
  //财产编号
  router.post("/getAssetNo", (req, res) => {
    const { assetType, orgCode, deptCode } = req.body
    let sql

    sql = " select * from xx_general_asset_equip_list "
    sql += " where 1 = 1 "
    if (orgCode) {
      sql += " and dept_code like '" + orgCode + "%' "
    }
    if (deptCode) {
      sql += " and dept_code = '" + deptCode + "' "
    }
    sql += " and asset_type = '"+ assetType +"' "
    sql += " order by dept_code,asset_no "
    callbackFn(res,oracle.connChaos,{sql})

  })

  return router
}
